#include<iostream>
using namespace std;
long long f[36];
int n=36;
void hanio(){
    f[1]=2;
    f[2]=8;
    for (int i = 3; i <= n; i++)
    {
        f[i]=3*f[i-1]+2;
    }
    
}
int main(){
    int m;
    hanio();
    while (cin>>m)
    {
        cout<<f[m]<<endl;
    }
    
}
